<?php
$v_af_id = $_REQUEST['af_id'];
$v_ip_address = gethostbyaddr($_SERVER['REMOTE_ADDR']);
if(isset($_REQUEST['v_session'])){
	$v_session = trim($_REQUEST['v_session']);
}else{
	$v_session= rand(1,999999999).session_id();
}
if($v_af_id > 0){
	if(_is_sqlserver()){
		//Cap nhat thong tin da tra cuu
		$sql = "ONEGATE_ViewedAfUpdate " . $v_af_id;
		$sql = $sql .",'". $v_ip_address . "'" ;
		$sql = $sql .",'". $v_session . "'" ;
		$ado_conn->SetFetchMode(ADODB_FETCH_ASSOC);
		$rs = $ado_conn->GetRow($sql); 
	
		$sql = "Exec Onegate_AFGetSingle '" . $v_af_id ."'";
		$ado_conn->SetFetchMode(ADODB_FETCH_ASSOC);
		$rs_single_af = $ado_conn->GetRow($sql);
		
		// Lay cac file dinh kem
		$cmd = @mssql_init("Onegate_AFFileGetAll",$conn);
		@mssql_bind($cmd,"@p_af_id",$v_af_id,SQLINT4);
		$result = @mssql_execute($cmd);
		$rs_single_af_file = _get_row_to_array($result);
		$v_total_file = sizeof($rs_single_af_file);
		//Lay cac TTHC lien quan
		$cmd = @mssql_init("ONEGATE_AF_AFConcernList",$conn);		
		@mssql_bind($cmd,"@p_af_id",$v_af_id,SQLINT4);
		$result = @mssql_execute($cmd);
		$arr_af_concern = _get_row_to_array($result); 
		@mssql_free_result($result);
		$v_total_af_concern = sizeof($arr_af_concern);
  }		
}
?>

